package dataMgr;

import org.hibernate.Session;
import org.hibernate.Transaction;

public class UserManager {
	
	 private Session session = null;
	 public UserManager(Session session) {
	  if(session == null)
	    throw new 
	      RuntimeException("Invalid session object.");
	  this.session = session;
	 }
	 public void saveUser(User user){
		 
		 System.out.println("save user");
		 Transaction tx = session.beginTransaction();		 
	  session.save(user);
	  tx.commit();
	 }
	 public void updateUser(User user){
	  session.update(user);
	 }
	 public void deleteUser(User user) {
	  session.delete(user);
	 }
	}